package it.davial.mgwt.client.ui.widget;

import com.google.gwt.dom.client.AreaElement;
import com.google.gwt.dom.client.Document;
import com.google.gwt.dom.client.MapElement;
import com.google.gwt.event.dom.client.HasMouseDownHandlers;
import com.google.gwt.event.dom.client.MouseDownEvent;
import com.google.gwt.event.dom.client.MouseDownHandler;
import com.google.gwt.event.shared.HandlerRegistration;
import com.google.gwt.resources.client.ImageResource;
import com.google.gwt.user.client.ui.Widget;

public class ImageMap extends Widget implements HasMouseDownHandlers {

	  private MapElement mapElement;

	  public ImageMap() {
	    mapElement = Document.get().createMapElement();
	    setElement(mapElement);
	  }

	  public void setResource(ImageResource resource){
		  //this.set
	  }
	  public String getImgName() {
	    return mapElement.getName();
	  }

	  public void setImgName(String imgName) {
	    mapElement.setName(imgName);
	  }

	  public void addMapArea(AreaElement area) {
	    mapElement.appendChild(area);
	  }

	  public HandlerRegistration addMouseDownHandler(MouseDownHandler handler) {
	    return addDomHandler(handler, MouseDownEvent.getType());
	  }

	}